<template>
	<public-view navType="carSelect" navTitle="选车">
		<view class="content flex f-d-c">
			<scroll-view scroll-y="true" class="list-scroll-view" :scroll-into-view="scroll_view" :scroll-with-animation="true">
				<view class="flex f-d-c w-100">
					<view class="" id="id0">
						
					</view>
					<block v-for="(item, index) in brand_list" :key="index">
						<view class="box-item" :id="'id'+item.letter">
							<view class="title">
								{{item.letter||""}}
							</view>
							<block v-for="(itm,idx) in item.children" :key="idx">
								<view class="items flex a-i-c" @click="goTo({url:`/pages/findCarSearch/searchInfo?title=${itm.name}&id=${itm.id}`})">
									<image class="icon" :src="itm.logo" mode=""></image>
									<view class="title f-s-26 color-333">
										{{itm.name||""}}
									</view>
								</view>
							</block>
						</view>
					</block>
				</view>
			</scroll-view>
			<view class="abc-right flex f-d-c a-i-c">
				<block v-for="(item, index) in sel_list" :key="index">
					<view class="ding all-center color-fff" v-if="item === '0'" @click="changeScrollViewId(0)">
						顶
					</view>
					<view class="items f-s-26 all-center" v-else @click="changeScrollViewId(item)">
						{{item}}
					</view>
				</block>
			</view>
		</view>
	</public-view>
	
</template>

<script>
	import {goTo} from "@/nav.js"
	export default {
		data() {
			return {
				sel_list:['0','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
				brand_list:[],
				scroll_view:"id0",
				scroll_top:1
			};
		},
		onLoad() {
			this.brand_list = this.$store.state.brand_list
			console.log(this.brand_list)
		},
		methods:{
			goTo,
			changeScrollViewId(id){
				console.log(id)
				this.scroll_view = `id${id}`
			}
		}
	}
</script>

<style lang="scss" scoped>
	.abc-right{
		position: fixed;
		right: 32upx;
		.items{
			width: 30upx;
			height: 30upx;
			margin-bottom: 10upx;
		}
		.active{
			background: #2567F3;
		}
		.ding{
			background: #767676;
			width: 30upx;
			height: 30upx;
			border-radius: 50%;
			font-size: 16upx;
			margin-bottom: 10upx;
		}
	}
	.list-scroll-view{
		width: 100%;
		height: 90vh;
		.box-item{
			width: 100%;
			margin-bottom: 32upx;
			.items{
				width: 100%;
				height: 112upx;
				padding-left: 18upx;
				background: #FFFFFF;
				.icon{
					width: 80upx;
					height: 80upx;
					margin-right: 24upx;
				}
			}
			.title{
				line-height: 42upx;
				margin-bottom: 8upx;
			}
		}
	}
	.content{
		width: 750upx;
		margin-bottom: 18uox;
		padding: 0 66upx 0 28upx;
		position: relative;
		height: 91vh;
	}
</style>
